package com.lookme.lmtool.cracker.filter.effect;

import com.jhlabs.image.SharpenFilter;
import com.jhlabs.image.UnsharpFilter;
import com.lookme.lmtool.cracker.CrackerConstants;
import com.lookme.lmtool.cracker.annotation.FilterAnnotation;
import com.lookme.lmtool.cracker.annotation.ParamAnnotation;
import com.lookme.lmtool.cracker.filter.AbstractFilter;
import com.thoughtworks.xstream.annotations.XStreamAsAttribute;

import java.awt.image.BufferedImageOp;

@FilterAnnotation(groupName = CrackerConstants.FILTER_GROUP_NAME_EFFECT,name="取消锐化",filterClass = UnsharpFilter.class)
public class FilterUnsharp extends AbstractFilter {
    @XStreamAsAttribute
    @ParamAnnotation(name = "半径", desc = "半径",inputType = ParamAnnotation.InputType.Slider,width = 300,amountToStepBy = 0.05,max = 200)
    float radius=2;

    @XStreamAsAttribute
    @ParamAnnotation(name = "数量", desc = "数量",inputType = ParamAnnotation.InputType.Slider,width = 300,amountToStepBy = 0.05,max = 100)
    float amount = 0.5F;

    @XStreamAsAttribute
    @ParamAnnotation(name = "阀值", desc = "阀值",inputType = ParamAnnotation.InputType.Slider,width = 300,max=256)
    int threshold=1;

    @Override
    public BufferedImageOp getFilter() {
        UnsharpFilter filter= new UnsharpFilter();
        filter.setRadius(radius);
        filter.setAmount(amount);
        filter.setThreshold(threshold);
        return filter;
    }
}
